#ifndef __IO_FILESERIALIZER_H__
#define __IO_FILESERIALIZER_H__

#include "../IO/ISerializable.h"

class IFileStream;
class CFileSerializer : public ISerializer
{
public:
	CFileSerializer(bool bEncrypt, bool bWriteMode);
	virtual ~CFileSerializer();

	bool Initialize(const std::string & strFileName);
	void Close();

	virtual bool IsWriteMode()
	{
		return m_bWriteMode;
	}

	virtual void Serialize(bool & rBoolData);
	virtual void Serialize(char & rCharData);
	virtual void Serialize(unsigned char & rUCharData);
	virtual void Serialize(short & rShortData);
	virtual void Serialize(unsigned short & rUShortData);
	virtual void Serialize(int & rIntData);
	virtual void Serialize(unsigned int & rUIntData);
	virtual void Serialize(__int64 & rInt64Data);
	virtual void Serialize(unsigned __int64 & rUInt64Data);
	virtual void Serialize(float & rFloatData);
	virtual void Serialize(double & rDoubleData);

	virtual void Serialize(std::string & rStrData);
	virtual void Serialize(char * pData, int nSize);

private:
	IFileStream & _FileStream();
	bool _InitializeR(const std::string & strFileName);
	bool _InitializeW(const std::string & strFileName);

	IFileStream * pFS;
	bool m_bWriteMode;
};

#endif //__IO_FILESERIALIZER_H__
